package luigibros.window.proccessers;


import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import luigibros.logic.Collidable;
import luigibros.logic.ScreenOccupant;

/**Removes non-collidable objects and returns a new ArrayList
 * 
 * @author jackieberg7
 *
 */
public class CollisionFilter
{
	private Collidable ScreenOccupant;
	
	/**Converts map of collided objects into an Arraylist
	 * 
	 * @author jackieberg7
	 * @param collisions - map of collided objects
	 * @return format - ArrayList of collided objects
	 */
	public ArrayList converter(Map<ScreenOccupant, List<Character>> collisions)
	{
/*		for(int x = 0; x < collisions.size(); x++)
//		{
//			ArrayList<Character[]> format = new ArrayList<Character[]>();
//			List<Character> tempKey = ;
//			for(int y = 0; y < info.size(); y++)
//			{
//				Character[] collidedWith = new Character[2];
//				collidedWith[0] = tempKey;
//				collidedWith[1] = info.get(y);
//				format.add(collidedWith);
//			}
//			return format;
		}
		*/
		ArrayList<ScreenOccupant> format = new ArrayList<ScreenOccupant>(collisions.keySet());
		ArrayList<ScreenOccupant> formatted = new ArrayList<ScreenOccupant>();
		int y = 0;
		for(int x = 0; x < format.size();)
		{
			if(format.get(x) instanceof Collidable)
			{
				formatted.add(format.get(x));
				y++;
			}
			x++;
		}
		return formatted;
	}
	
	/**Removes non-collidable objects and returns a new ArrayList
	 *
	 * @author jackieberg7
	 * @param collisionArrayList - contains 2-element arrays of collided objects
	 * @return collisionArrayList - list of arrays of collidable objects
	 */
/*	public ArrayList filter(ArrayList<Character[]> format)
	{
		Character[] collisionArray = new Character[2];
		
		for(int x = 0; x < format.size(); x++)
		{
			collisionArray = format.get(x);
			if(collisionArray[0] instanceof Collidable == false
					&& collisionArray[1] instanceof Collidable == false)
				format.remove(x);
		}
		return format;
	}
*/
}
